/*
 * 按比例缩放图片
 * 屹砾(C)2009
 * 
 * destImage 源图片
 * width 最大宽度
 * height 最大高度
 */
function resizeImage(destImage, width, height) {
	var image = new Image();
	image.src = destImage.src;
	if ((image.width > 0) && (image.height > 0)) {
		if ((image.width / image.height) >= (width / height)) {
			if (image.width > width) {
				destImage.width = width;
				destImage.height = (image.height * width) / image.width;
			} else {
				destImage.width = image.width;
				destImage.height = image.height;
			}
		} else {
			if (image.height > height) {
				destImage.height = height;
				destImage.width = (image.width * height) / image.height;
			} else {
				destImage.width = image.width;
				destImage.height = image.height;
			}
		}
	}
}